package callnumber.gtdev5.com.photoVault.application;

import android.app.Activity;
import android.content.Context;
import android.support.multidex.MultiDex;

import com.gtdev5.geetolsdk.mylibrary.initialization.GeetolSDK;

import org.litepal.LitePalApplication;

import java.util.ArrayList;
import java.util.List;

import callnumber.gtdev5.com.photoVault.base.BaseActivity;


/**
 * Created by cheng
 * PackageName FakeCall
 * 2018/6/11 11:26
 */

public class MyApplication extends LitePalApplication {
    private static MyApplication application;
    private static List<BaseActivity> activityList;     //activity管理集合
    private static List<Activity> lists=new ArrayList<>();
    @Override
    public void onCreate() {
        super.onCreate();
        application=this;
        GeetolSDK.init(application);
        activityList = new ArrayList<BaseActivity>();
    }

    @Override
    protected void attachBaseContext(Context base) {
        super.attachBaseContext( base );
        MultiDex.install(this);
    }
    public static MyApplication getInstance(){
        return application;
    }
    public void doForFinish(BaseActivity activity){
        activityList.remove(activity);
    }

    public static void addActivity(Activity activity) {
        lists.add(activity);
    }
    public static void clearActivity() {
        if (lists != null) {
            for (Activity activity : lists) {
                activity.finish();
            }

            lists.clear();
        }
    }

}
